package edu.gmu.middleware;

import java.io.IOException;
import java.nio.ByteBuffer;

/**
 * The Marshaler object will take a Message Object and
 * marshal it into a ByteBuffer.  The ByteBuffer will include a middleware
 * header and is usually passed via a socket though nothing
 * prevents other outputs (e.g. file).
 * 
 * @author  James H. Pope
 * @version $Revision:$ $Date:$
 */
public interface Marshaler
{
    /**
     * Marshals the given message into the given buffer.
     * @param header (caller sets desired endian-order and topic)
     * @param message
     * @param out
     * @throws IOException If there is an error marshaling the message
     */
    public void marshal(    Header header,
                            Message message,
                            ByteBuffer out) throws IOException;
}
